// components/CanAccess.tsx
'use client';
import { useContext } from 'react';
import { AuthContext } from '@/context/auth-context';

export default function CanAccess({ permission, children }: any) {
  //@ts-ignore
	const { user } = useContext(AuthContext);

	if (!user?.permissions?.includes(permission)) return null;

	return children;
}
